package com.zhouixi.ras_js_java.utils;

import com.zhouixi.ras_js_java.enums.ResultEnum;

public class RetResponse {
		private final static String SUCCESS = "success";
		private final static String ERROR = "error";
	 
	   public static <T> RetResult<T> makeOKRsp() {
	      return new RetResult<T>().setCode(ResultEnum.SUCCESS).setMsg(SUCCESS);
	   }
	 
	   public static <T> RetResult<T> makeOKRsp(T data) {
	      return new RetResult<T>().setCode(ResultEnum.SUCCESS).setMsg(SUCCESS).setData(data);
	   }
	 
	   public static <T> RetResult<T> makeErrRsp(String message) {
	      return new RetResult<T>().setCode(ResultEnum.ERROR).setMsg(ERROR);
	   }
	   
	   public static <T> RetResult<T> makeErrRsp(ResultEnum resultEnum) {
		      return new RetResult<T>().setCode(ResultEnum.ERROR).setMsg(ERROR);
	   }
	 
	   public static <T> RetResult<T> makeRsp(int code, String msg) {
	      return new RetResult<T>().setCode(code).setMsg(msg);
	   }
	    
	   public static <T> RetResult<T> makeRsp(int code, String msg, T data) {
	      return new RetResult<T>().setCode(code).setMsg(msg).setData(data);
	   }
}
